package com.hzncc.flowable_diboot.contract.vo;

import com.diboot.core.binding.annotation.*;
import com.diboot.core.vo.FileVO;
import com.diboot.core.vo.LabelValue;
import com.diboot.file.entity.FileRecord;
import com.diboot.iam.entity.IamUser;
import com.hzncc.flowable_diboot.contract.entity.ContractInfo;
import com.hzncc.flowable_diboot.entity.SapCustomer;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.util.List;

/**
* 合同基础信息 VO定义
* @author MyName
* @version 1.0
* @date 2024-07-12
* Copyright © MyCorp
*/
@Getter @Setter @Accessors(chain = true)
public class ContractInfoListVO extends ContractInfo  {
private static final long serialVersionUID = 1187360140115766699L;
    /**
    * 创建人 关联信息
    */

    @BindField(
        entity = IamUser.class,
        field = "realname",
        condition = "this.create_by = id"
     )
    private String createByLabel;

    /**
    * 更新人 关联信息
    */

    @BindField(
        entity = IamUser.class,
        field = "realname",
        condition = "this.update_by = id"
     )
    private String updateByLabel;

    /**
     * 客户姓名
     */
    @BindField(
            entity = SapCustomer.class,
            field = "name",
            condition = "this.customer_id = id"
    )
    private String customerName;

    /**
     * 合同附件
     */
    @BindEntityList(
            entity = FileRecord.class,
            condition = "this.contractFile=id",
            splitBy = ","
    )
    private List<FileVO> contractFileFiles;

    /**
     * 补充附件
     */
    @BindEntityList(
            entity = FileRecord.class,
            condition = "this.attachmentFile=id",
            splitBy = ","
    )
    private List<FileVO> attachmentFileFiles;

    @BindDict(
            type = "currency",
            field = "currency"
    )
    private LabelValue currencyLabel;
}